//
//  SingerDetailsTableViewCell.swift
//  ShareMusic
//
//  Created by 胡岩 on 16/5/3.
//  Copyright © 2016年 胡岩. All rights reserved.
//

import UIKit

class SingerDetailsTableViewCell: UITableViewCell {

    var icon:UIImageView?
    var name:UILabel?
    var shadow:UIView?
    private var mo:SingerDetailsModel?
    var model:SingerDetailsModel {
        get {
            return mo!
        }
        set {
            mo = newValue
            icon?.sd_setImageWithURL(NSURL.init(string: mo!.pic_url!), placeholderImage: nil)
            name?.text = mo!.singer_name
        }
    }
    
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        icon = UIImageView.init()
        name = UILabel.init()
        shadow = UIView.init()
        
        self.contentView.addSubview(shadow!)
        self.contentView.addSubview(icon!)
        self.contentView.addSubview(name!)
    }
    
    
    
    override func layoutSubviews() {
        super.layoutSubviews()
        shadow?.frame = self.contentView.bounds
        shadow?.backgroundColor = UIColor.blackColor()
        icon?.frame = CGRectMake(10, 5, 60, 60)
        icon?.contentMode = UIViewContentMode.ScaleAspectFill
        icon?.clipsToBounds = true
        icon?.layer.cornerRadius = 4
        name?.frame  = CGRectMake(90, 0, 200, self.contentView.frame.size.height)
        name?.font = UIFont.systemFontOfSize(20)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
